<?php
require 'facebook-php/src/facebook.php';
/*
$facebook = new Facebook(array(
  'appId'  => '132232896902123',
  'secret' => 'dccf76cf33f34a845764027b54b84ff8',
));
*/
function loginfacebook_p1(){
$facebook = new Facebook(array(
  'appId'  => '132232896902123',
  'secret' => 'dccf76cf33f34a845764027b54b84ff8',
));
  $loginUrl = $facebook->getLoginUrl();
  echo '<a href="'.$loginUrl.'"><img src="images/facebook.png" align="absmiddle" hspace="5"></a>&nbsp;';
 
}
function loginfacebook_p2(){
$facebook = new Facebook(array(
  'appId'  => '132232896902123',
  'secret' => 'dccf76cf33f34a845764027b54b84ff8',
));
$user = $facebook->getUser();

if ($user) {
  try {
    // Proceed knowing you have a logged in user who's authenticated.
	$logoutUrl = $facebook->getLogoutUrl();
    $user_profile = $facebook->api('/me');
	header('Location: http://www.jumaro.com.ar');
	/*
	echo "<pre>tu mail:".$user_profile['email']."</pre>";
	echo "<pre>tu nombre:".$user_profile['name']."</pre>";	
	
	<pre><img src="https://graph.facebook.com/<?php echo $user; ?>/picture"></pre>
	<a href="<?php echo $logoutUrl; ?>">Logout</a>
	<?php
	*/
	
  } catch (FacebookApiException $e) {
    error_log($e);
    $user = null;
  }
}

}


?>